import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _applyDecoratedDescriptor from "@babel/runtime/helpers/esm/applyDecoratedDescriptor";

var _dec, _dec2, _dec3, _class, _class2;

/**
 * SearchForm
 * @date 2019-08-14
 */
import React from 'react';
import { Form, Input, Button, Row, Col } from 'antd';
import { Bind } from 'lodash-decorators';
import intl from 'utils/intl';
import { FORM_COL_3_LAYOUT, FORM_FIELD_CLASSNAME, SEARCH_COL_CLASSNAME, SEARCH_FORM_ITEM_LAYOUT, SEARCH_FORM_ROW_LAYOUT } from 'utils/constants';
var SearchForm = (_dec = Form.create({
  fieldNameProp: null
}), _dec2 = Bind(), _dec3 = Bind(), _dec(_class = (_class2 = /*#__PURE__*/function (_React$Component) {
  _inherits(SearchForm, _React$Component);

  var _super = _createSuper(SearchForm);

  function SearchForm() {
    _classCallCheck(this, SearchForm);

    return _super.apply(this, arguments);
  }

  _createClass(SearchForm, [{
    key: "handleSearchBtnClick",
    value: function handleSearchBtnClick() {
      var onSearch = this.props.onSearch;
      onSearch();
    }
  }, {
    key: "handleResetBtnClick",
    value: function handleResetBtnClick() {
      var form = this.props.form;
      form.resetFields();
    }
  }, {
    key: "render",
    value: function render() {
      var _this$props = this.props,
          _this$props$form$getF = _this$props.form.getFieldDecorator,
          getFieldDecorator = _this$props$form$getF === void 0 ? function (e) {
        return e;
      } : _this$props$form$getF,
          disabled = _this$props.disabled;
      return /*#__PURE__*/React.createElement(Form, null, /*#__PURE__*/React.createElement(Row, Object.assign({
        type: "flex",
        gutter: 24,
        align: "bottom"
      }, SEARCH_FORM_ROW_LAYOUT), /*#__PURE__*/React.createElement(Col, FORM_COL_3_LAYOUT, /*#__PURE__*/React.createElement(Form.Item, Object.assign({}, SEARCH_FORM_ITEM_LAYOUT, {
        label: intl.get('ciam.roleManagement.model.roleManagement.userLoginName').d('用户名')
      }), getFieldDecorator('userRealName')( /*#__PURE__*/React.createElement(Input, {
        className: FORM_FIELD_CLASSNAME
      })))), /*#__PURE__*/React.createElement(Col, Object.assign({}, FORM_COL_3_LAYOUT, {
        className: SEARCH_COL_CLASSNAME
      }), /*#__PURE__*/React.createElement(Form.Item, null, /*#__PURE__*/React.createElement(Button, {
        onClick: this.handleResetBtnClick
      }, intl.get('cpaas.common.button.reset').d('重置')), /*#__PURE__*/React.createElement(Button, {
        type: "primary",
        htmlType: "submit",
        onClick: this.handleSearchBtnClick,
        disabled: disabled
      }, intl.get('cpaas.common.button.search').d('查询'))))));
    }
  }]);

  return SearchForm;
}(React.Component), (_applyDecoratedDescriptor(_class2.prototype, "handleSearchBtnClick", [_dec2], Object.getOwnPropertyDescriptor(_class2.prototype, "handleSearchBtnClick"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleResetBtnClick", [_dec3], Object.getOwnPropertyDescriptor(_class2.prototype, "handleResetBtnClick"), _class2.prototype)), _class2)) || _class);
export { SearchForm as default };